import request from "@/utils/request";
import type { homeworkForm, submissionForm } from "./type";
// 获取所有作业
export const getHomework = (cid: any) => {
  return request.get(`${"/homework"}/${cid}`);
};
export const addHomework = (homework: homeworkForm) => {
  return request.post("/homework", homework);
};
// 学生端获取作业信息,cid是课程id，sid是学生id
export const studentHomework = (cid: any, sid: any) => {
  return request.get(`${"/homework"}/${cid}/${sid}`);
};
export const subHomework = (submission: submissionForm) => {
  return request.post("/homework/addSubmission", submission);
};
export const getSubmission = (homeworkId: number) => {
  return request.get(`${"/homework/submissions"}/${homeworkId}`);
};
export const updateScore = (submission: submissionForm) => {
  return request.put("/homework/updateScore", submission);
};
